package com.david.client.rpc;

import com.david.client.dto.UserDTO;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface IUserManager extends RemoteService {
	public final int DUPLICATE_ID = 1;

	public final int NO_AUTHORIZATION = 2;

	public final int DB_ERROR = 3;

	public final int SUCCESS = 4;

	public static final String SERVICE_URI = "/com.david.ERP/UserManagerService";

	public static class Util {

		public static IUserManagerAsync getInstance() {

			IUserManagerAsync instance = (IUserManagerAsync) GWT
					.create(IUserManager.class);
			ServiceDefTarget target = (ServiceDefTarget) instance;
			target.setServiceEntryPoint(GWT.getModuleBaseURL() + SERVICE_URI);
			return instance;
		}
	}	
	/*
	 * @return indicate whether success or error type
	 */
	public int addNewUser(UserDTO user);
}
